<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理系统</title>
<js href="__PUBLIC__/Js/Jquery/jquery-1.4.4.min.js" />
<script language="javascript" type="text/javascript" src="../Public/js/cal.js"></script>
<link href="../Public/admin/css/golbal.css" rel="stylesheet" type="text/css" />
<link href="../Public/admin/css/member.css" rel="stylesheet" type="text/css" />
<link href="../Public/css/cal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#popupShare {
	font-size:13px;
	padding:12px;
	z-index:2000;
	border:3px solid #cecece;
	background:#223344;
	width:100px;
	height:100px;
	position:absolute;
	display:none;
}

#popupClose{
	font-size: 14px;
	line-height: 14px;
	position: absolute;
	right: 6px; 
	top: 8px; 
	color: #6fa5fd; 
	font-weight: 700;
	display: block;
	float:right;
}

</style>
</head>

<body>
<div class="tittle">
<span>气象网管理中心—-图片类资源共享</span>
</div>

<div class="infor">
<form action="{:U('Share/pictures')}" method="post">
<img src="../Public/admin/images/zoom.jpg" />
<p><span>图片分类 </span>
<select name='type1' id="tid1">
<eq name='type' value='1'>
<option value=1 selected>图片资源</option><else/>
<option value=1 >图片资源</option></eq>

<eq name='type' value='2'>
<option value=2 selected>挂图资源</option><else/>
<option value=2 >挂图资源</option></eq>

<eq name='type' value='3'>
<option value=3 selected>展品资源</option><else/>
<option value=3 >展品资源</option></eq>

</select></p>
<p><span>同步时间 </span>
<input type="text" id='tftime' name='tftime' value=""/>
至<input type="text" id='tttime' name='tttime' value=""/>
</p>
<empty name='maxtime'>
<span>最新上传时间:没有同步</span><else/>
<span>最新上传时间{$maxtime|date='Y-m-d H:i:s',###}</span>
</empty>
<input class="sear" name='sub2' type="submit" value="同步" />
</form>
</div>

<div class="infor">
<form action="{:U('Share/pictures')}" method="post">
<img src="../Public/admin/images/zoom.jpg" />
<p><span>图片分类 </span>
<select name='type1' id="tid1">
<eq name='type' value='1'>
<option value=1 selected>图片资源</option>
<else/>
<option value=1 >图片资源</option>
</eq>

<eq name='type' value='2'>
<option value=2 selected>挂图资源</option>
<else/>
<option value=2 >挂图资源</option>
</eq>

<eq name='type' value='3'>
<option value=3 selected>展品资源</option>
<else/>
<option value=3 >展品资源</option>
</eq>
</select></p>
<p><span>编号</span>
<input type="text" id='lmaxs' name='Num' value=""/>
</p>
<p><span>上传时间 </span>
<empty name='ftime'>
<input type="text" id='ftime' name='ftime' value=""/><else/>
<input type="text" id='ftime' name='ftime' value="{$ftime|date='Y-m-d',###}"/>
</empty>
</p>
<p><span>至 </span>
<empty name='ttime'>
<input type="text" id='ttime' name='ttime' value=""/><else/>
<input type="text" id='ttime' name='ttime' value="{$ttime|date='Y-m-d',###}"/>
</empty>
</p>
<input class="sear" name='sub1' type="submit" value="搜索" />
</form>
</div>

<div class="detab">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr class="thi">
<th width="40"><input type="checkbox" class="checkall"></th>
<th width="60">编号</th>
<th width="150">标题</th>
<th width="95">资源分类</th>
<th width="150">上传时间</th>
<th width="175">共享发布时间</th>
<!-- <th width="95">注册日期</th> -->
<th width="195">操作</th>
</tr>
<volist id="vo" name="list">
<tr>
<td><input type="checkbox" value="{$vo.id}" class="checkitem"></td>
<td>{$vo.code}</td>
<td>{$vo.title}</td>
<td>{$vo.catename}</td>
<td>{$vo.uploadtime|date='Y-m-d',###}</td>
<neq name="vo['sharetime']" value="0">
<td>{$vo.sharetime|date='Y-m-d',###}</td>
<else/>
<td></td>
</neq>
<!-- <td>{$vo.regtime|date="Y-m-d",###}</td> -->
<td class="last_bt"><a href="javascript:void(0);" onclick="lookpicture('{$vo.url}','{$vo.area}')" class="look">查看</a><a href="javascript:void(0);" onclick="editpicture('{$vo['uid']}');" class="edit">编辑</a><a href="javascript:void(0);" onclick="sendpicture('{$vo['uid']}');" class="move">发送</a></td>
</tr>
</volist>
</tbody>
</table>
</div>

<div id="popupShare"><a href="#" id="popupClose">关闭</a>
<img src='__PUBLIC__/Uploads/Picture/' id="popupImg1">
</div>

<div style="float:left"><input class="formbtn batchButton" type="button" value="发布" name="id" uri="{:U('Share/sendpicture')}" /></div>
<div class="num">
{$page}
</div>
<div class="clear"></div>

<script type="text/javascript">

//搜索
$(function(){
	
	$('.checkall').click(function(){
	    $('.checkitem').attr('checked', this.checked);
	});
	
	$('.batchButton').click(function(){
		if($('.checkitem:checked').length==0){
			alert('请选择一个共享资源!');
			return false;
		}

	    var items = '';
	    $('.checkitem:checked').each(function(){
	        items += this.value + ',';
	    });
	    
	    items = items.substr(0, (items.length - 1));
	    /* 将选中的项通过post方式提交给指定的URI */
	    var uri = $(this).attr('uri');
	    var id = items;
	 	
	    $.post(uri,{id:id},function(res){
	    		if(res!=0){
	    			alert('已经发送!');
	    		}else alert(res);
	    	});
	});
	
	$('#popupClose').click(function(){
		$('#popupShare').hide();
		if($('#popupImg2').length>0){
			$('#popupImg2').remove();
		}
	});
	
});

	function Popup(width,height){
	/*
		var windowWidth=document.documentElement.clientWidth;
		var windowHeight=document.documentElement.clientHeight;

		var popupHeight = $("#popupShare").height();   
		var popupWidth = $("#popupShare").width();   

		*/
		$("#popupShare").css({"position": "absolute","top": "100px","left": "100px","width":width,"height":height});		
		$("#popupShare").show();

	}

    function lookpicture(url,area){

    	var picurl1=$('#popupImg1').attr('src');

    	if(url.indexOf(',')>0){
    		var picurl=url.split(',');
    		$(picurl).each(function(k,v){
    			var image=$('<img src='+picurl1+v+' id=popupImg'+k+' onmouseover=\"pn(this);\" style=\"cursor:hand;display:none;\" width='+width+' height='+ height + '>');
    			$('#popupShare').append(image);
    		});
    		if($('#popupImg0').length>0){
    			
    		}
    		
    	}else{
    		//alert(area);
    		if($('#popupImg2').length>0){
    			
    			var areas=area.split('x');
    			if(areas[0]>700){
    				var width=areas[0]/2;
    			}else{
    				var width=areas[0];
    			}
    			if(areas[1]>500){
    				var height=areas[1]/2;
    			}else{
    				var height=areas[1];
    			}			
    			Popup(width+20,height+20);
    			
    		}else{
    			var areas=area.split('x');
    			if(areas[0]>700){
    				var width=parseFloat(areas[0]/2);
    			}else{
    				var width=parseFloat(areas[0]);
    			}
    			if(areas[1]>500){
    				var height=parseFloat(areas[1]/2);
    			}else{
    				var height=parseFloat(areas[1]);
    			}
    			//alert('<img src='+picurl1+url+' id=popupImg2 width='+ width+' height='+height+'>');
    			var image=$('<img src='+picurl1+url+' id=popupImg2 width='+ width+' height='+height+'>');
    			$('#popupShare').append(image);
    			width+=20;
    			height+=20;
    			Popup(width,height);
    		}
    	}
    	
    }
</script>
</body>
</html>
